<template>
  <div>
  <h2>会员登录1</h2>
  <hr>
  <table>
    <tr>
      <td>账号:</td>
      <td>
        <input type="text" v-model="state.Name">
      </td>
    </tr>
    <tr>
      <td>密码:</td>
      <td>
        <input type="password" v-model="state.Pwd">
      </td>
    </tr>
    <tr>
      <td colspan="2">
    <input type="button" value="登录" @click="Login">
      </td>
    </tr>
  </table>
  </div>
</template>

<script setup lang="ts">
import{reactive,toRefs,onMounted} from 'vue';
import{useRouter,useRoute} from 'vue-router';
import axios from 'axios';

const router=useRouter();
const route=useRoute();

let data:any=reactive({
  state:{
    Name:'',
    Pwd:''
  }

})
let {state}=toRefs(data);

function Login(){
  let obj={
    Name:state.value.Name,
    Pwd:state.value.Pwd
  }
  axios({
    url:'https://localhost:7280/api/Member/Login',
    method:'post',
    params:obj
  })
  .then(res=>{
    if(res.data.data>0)
  {
    alert('登录成功')
    router.push('/MemberAdd')
  }
  else{
    alert('登录失败')
    return
  }
  })
  .catch(err=>{
    console.log(err)
  })
}



</script>

<style scoped>

</style>